#pragma once

#include <atlctrls.h>
#include <atlmisc.h>

#include <string>

#include <atlscrl.h>
#include <atlframe.h>
#include <atlwince.h>

class MemoEdit : public CWindowImpl<MemoEdit, CRichInkCtrl>
{
    typedef CWindowImpl<MemoEdit, CRichInkCtrl> _thisClass;

public:
    DECLARE_WND_SUPERCLASS(NULL, CRichInkCtrl::GetWndClassName());

    MemoEdit() : hReadFile(INVALID_HANDLE_VALUE) 
    {}

    BOOL PreTranslateMessage(MSG*)
    {
        return FALSE;
    }

    BEGIN_MSG_MAP(_thisClass)
    END_MSG_MAP()

    void Save(const std::wstring fileName, bool unicode);
    void Load(const std::wstring fileName, bool unicode);

    ~MemoEdit()
    {
        if (hReadFile != INVALID_HANDLE_VALUE)
            ::CloseHandle(hReadFile);
    }

private:
    HANDLE hReadFile;
};